package bme.andraskindler.treenventory.model;

import java.io.Serializable;
import java.util.Date;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.google.android.gms.maps.model.LatLng;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

@Table(name = "treedatabase")
public class TreeData extends Model implements Serializable {

	private static final long serialVersionUID = 1L;

	@Column(name = "treeid")
	@Expose
	@SerializedName("id")
	private long treeid;

	@Column(name = "type")
	@Expose
	@SerializedName("type")
	private String type;

	@Column(name = "longitude")
	@Expose
	@SerializedName("longitude")
	private Double longitude;

	@Column(name = "latitude")
	@Expose
	@SerializedName("latitude")
	private Double latitude;

	@Column(name = "width")
	@Expose
	@SerializedName("width")
	private Double width;

	@Column(name = "date")
	@Expose
	@SerializedName("date")
	private Long date;

	public TreeData() {
	}

	public TreeData(long id, String type, Double longitude, Double latitude, Double width, Long date) {
		super();
		this.treeid = id;
		this.type = type;
		this.longitude = longitude;
		this.latitude = latitude;
		this.width = width;
		this.date = date;
	}

	public Long getTreeid() {
		return treeid;
	}

	public void setTreeid(long id) {
		this.treeid = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getWidth() {
		return width;
	}

	public void setWidth(Double width) {
		this.width = width;
	}

	public Long getDate() {
		return date;
	}

	public void setDate(Long date) {
		this.date = date;
	}

	public LatLng getLatLng() {
		return new LatLng(latitude, longitude);
	}

	@Override
	public String toString() {
		return "TreeData [treeid=" + treeid + ", type=" + type + ", longitude=" + longitude + ", latitude=" + latitude + ", width=" + width + ", date=" + new Date(date).toString() + "]";
	}

}
